package com.xiaoshuidi.cloud.module.rooms.enums;

import cn.hutool.core.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum RoomEntrustStatusEnum {
    TBA("0","待指派"),
    FOLLOWING("1","跟进中"),
    FINISHED("2","已完成"),
    PHONED("3","已去电"),
    REVIEWED("4","已看房"),
    POSTPONED("5","已推迟"),
    INVALID("6","无效"),
    SIGNING("7","已签约"),
    GIVEUP("8","放弃");

    private String code;
    private String name;
//
    public static String getNameByCode(String code) {
        RoomEntrustStatusEnum roomEntrustStatusEnum = Arrays.stream(RoomEntrustStatusEnum.values()).filter(p -> p.code.equals(code)).findFirst().orElse(null);
        Assert.isTrue(roomEntrustStatusEnum != null, "RoomEntrustStatusEnum类型:{}不存在", code);
        return roomEntrustStatusEnum.getName();
    }
}
